package com.ruoyi.fts.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fts.mapper.FtsGoodsMapper;
import com.ruoyi.fts.domain.FtsGoods;
import com.ruoyi.fts.service.IFtsGoodsService;

/**
 * 商品Service业务层处理
 *
 * @author lumberer
 * @date 2024-10-15
 */
@Service
public class FtsGoodsServiceImpl extends ServiceImpl<FtsGoodsMapper, FtsGoods> implements IFtsGoodsService {
    @Autowired
    private FtsGoodsMapper ftsGoodsMapper;

    /**
     * 查询商品
     *
     * @param id 商品主键
     * @return 商品
     */
    @Override
    public FtsGoods selectFtsGoodsById(Long id) {
        return ftsGoodsMapper.selectFtsGoodsById(id);
    }

    /**
     * 查询商品列表
     *
     * @param ftsGoods 商品
     * @return 商品
     */
    @Override
    public List<FtsGoods> selectFtsGoodsList(FtsGoods ftsGoods) {
        return ftsGoodsMapper.selectFtsGoodsList(ftsGoods);
    }

    /**
     * 新增商品
     *
     * @param ftsGoods 商品
     * @return 结果
     */
    @Override
    public int insertFtsGoods(FtsGoods ftsGoods) {
                ftsGoods.setCreateTime(DateUtils.getNowDate());
            return ftsGoodsMapper.insert(ftsGoods);
    }

    /**
     * 修改商品
     *
     * @param ftsGoods 商品
     * @return 结果
     */
    @Override
    public int updateFtsGoods(FtsGoods ftsGoods) {
                ftsGoods.setUpdateTime(DateUtils.getNowDate());
        return ftsGoodsMapper.updateById(ftsGoods);
    }

    /**
     * 批量删除商品
     *
     * @param ids 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteFtsGoodsByIds(Long[] ids) {
        return ftsGoodsMapper.deleteFtsGoodsByIds(ids);
    }

    /**
     * 删除商品信息
     *
     * @param id 商品主键
     * @return 结果
     */
    @Override
    public int deleteFtsGoodsById(Long id) {
        return ftsGoodsMapper.deleteFtsGoodsById(id);
    }
}